(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     11709,        309]
NotebookOptionsPosition[     11051,        281]
NotebookOutlinePosition[     11588,        302]
CellTagsIndexPosition[     11545,        299]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell["Geometry", "Chapter"],

Cell[CellGroupData[{

Cell["\:8d1d\:585e\:5c14\:66f2\:7ebf(B\[EAcute]zier curve) de Casteljau\:7b97\
\:6cd5", "Subsubsection"],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"ClearAll", "[", "\"\<Global`*\>\"", "]"}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{"Manipulate", "[", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"Module", "[", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"p1", ",", "p2", ",", "p3", ",", "newP1", ",", "newP2"}], "}"}],
      ",", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"p1", " ", ":=", " ", 
       RowBox[{"{", 
        RowBox[{"0.1", ",", "0.3"}], "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"p2", " ", ":=", " ", 
       RowBox[{"{", 
        RowBox[{"0.4", ",", "0.7"}], "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"p3", " ", ":=", " ", 
       RowBox[{"{", 
        RowBox[{"0.8", ",", "0.4"}], "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"newP1", " ", ":=", " ", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{
             "p2", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], 
             "-", 
             RowBox[{
             "p1", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], 
            ")"}], "*", "t"}], "+", 
          RowBox[{
          "p1", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], ",", 
         RowBox[{
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{
             "p2", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], 
             "-", 
             RowBox[{
             "p1", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}], 
            ")"}], "*", "t"}], "+", 
          RowBox[{
          "p1", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}]}], 
        "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"newP2", " ", ":=", " ", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{
             "p3", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], 
             "-", 
             RowBox[{
             "p2", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], 
            ")"}], "*", "t"}], "+", 
          RowBox[{
          "p2", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], ",", 
         RowBox[{
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{
             "p3", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], 
             "-", 
             RowBox[{
             "p2", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}], 
            ")"}], "*", "t"}], "+", 
          RowBox[{
          "p2", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}]}], 
        "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"Graphics", "[", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"PointSize", "[", "Large", "]"}], ",", 
          "\[IndentingNewLine]", 
          RowBox[{"Point", "[", "p1", "]"}], ",", 
          RowBox[{"Point", "[", "p2", "]"}], ",", 
          RowBox[{"Point", "[", "p3", "]"}], ",", 
          RowBox[{"Line", "[", 
           RowBox[{"{", 
            RowBox[{"p1", ",", "p2"}], "}"}], "]"}], ",", 
          RowBox[{"Line", "[", 
           RowBox[{"{", 
            RowBox[{"p2", ",", "p3"}], "}"}], "]"}], ",", 
          "\[IndentingNewLine]", "Red", ",", 
          RowBox[{"Point", "[", "newP1", "]"}], ",", 
          RowBox[{"Point", "[", "newP2", "]"}], ",", 
          RowBox[{"Line", "[", 
           RowBox[{"{", 
            RowBox[{"newP1", ",", "newP2"}], "}"}], "]"}], ",", 
          "\[IndentingNewLine]", "Green", ",", 
          RowBox[{"Line", "@", 
           RowBox[{"Table", "[", 
            RowBox[{
             RowBox[{"{", 
              RowBox[{
               RowBox[{
                RowBox[{
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{
                   "newP2", "\[LeftDoubleBracket]", "1", 
                    "\[RightDoubleBracket]"}], "-", 
                   RowBox[{
                   "newP1", "\[LeftDoubleBracket]", "1", 
                    "\[RightDoubleBracket]"}]}], ")"}], "*", "t"}], "+", 
                RowBox[{
                "newP1", "\[LeftDoubleBracket]", "1", 
                 "\[RightDoubleBracket]"}]}], ",", 
               RowBox[{
                RowBox[{
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{
                   "newP2", "\[LeftDoubleBracket]", "2", 
                    "\[RightDoubleBracket]"}], "-", 
                   RowBox[{
                   "newP1", "\[LeftDoubleBracket]", "2", 
                    "\[RightDoubleBracket]"}]}], ")"}], "*", "t"}], "+", 
                RowBox[{
                "newP1", "\[LeftDoubleBracket]", "2", 
                 "\[RightDoubleBracket]"}]}]}], "}"}], ",", 
             RowBox[{"{", 
              RowBox[{"t", ",", "0", ",", "t", ",", "0.05"}], "}"}]}], 
            "]"}]}], ",", 
          RowBox[{"Point", "[", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{
                 "newP2", "\[LeftDoubleBracket]", "1", 
                  "\[RightDoubleBracket]"}], "-", 
                 RowBox[{
                 "newP1", "\[LeftDoubleBracket]", "1", 
                  "\[RightDoubleBracket]"}]}], ")"}], "*", "t"}], "+", 
              RowBox[{
              "newP1", "\[LeftDoubleBracket]", "1", 
               "\[RightDoubleBracket]"}]}], ",", 
             RowBox[{
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{
                 "newP2", "\[LeftDoubleBracket]", "2", 
                  "\[RightDoubleBracket]"}], "-", 
                 RowBox[{
                 "newP1", "\[LeftDoubleBracket]", "2", 
                  "\[RightDoubleBracket]"}]}], ")"}], "*", "t"}], "+", 
              RowBox[{
              "newP1", "\[LeftDoubleBracket]", "2", 
               "\[RightDoubleBracket]"}]}]}], "}"}], "]"}]}], 
         "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", 
        RowBox[{"Axes", "\[Rule]", "True"}], ",", "\[IndentingNewLine]", 
        RowBox[{"PlotRange", "\[Rule]", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{"0", ",", "1"}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{"0", ",", "1"}], "}"}]}], "}"}]}]}], 
       "\[IndentingNewLine]", "]"}]}]}], "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"t", ",", "0", ",", "1"}], "}"}]}], "]"}]}], "Input",
 Background->RGBColor[
  0.9529411764705882, 0.9529411764705882, 0.9529411764705882]],

Cell[BoxData[
 TagBox[
  StyleBox[
   DynamicModuleBox[{$CellContext`t$$ = 0, Typeset`show$$ = True, 
    Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", 
    Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = 
    "\"\:65e0\:6807\:9898\"", Typeset`specs$$ = {{
      Hold[$CellContext`t$$], 0, 1}}, Typeset`size$$ = {450., {220., 227.}}, 
    Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = 
    True, $CellContext`t$161440$$ = 0}, 
    DynamicBox[Manipulate`ManipulateBoxes[
     1, StandardForm, "Variables" :> {$CellContext`t$$ = 0}, 
      "ControllerVariables" :> {
        Hold[$CellContext`t$$, $CellContext`t$161440$$, 0]}, 
      "OtherVariables" :> {
       Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, 
        Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, 
        Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$,
         Typeset`skipInitDone$$}, "Body" :> 
      Module[{$CellContext`p1$, $CellContext`p2$, $CellContext`p3$, \
$CellContext`newP1$, $CellContext`newP2$}, $CellContext`p1$ := {0.1, 
          0.3}; $CellContext`p2$ := {0.4, 0.7}; $CellContext`p3$ := {0.8, 
          0.4}; $CellContext`newP1$ := {(Part[$CellContext`p2$, 1] - 
             Part[$CellContext`p1$, 1]) $CellContext`t$$ + 
           Part[$CellContext`p1$, 1], (Part[$CellContext`p2$, 2] - 
             Part[$CellContext`p1$, 2]) $CellContext`t$$ + 
           Part[$CellContext`p1$, 2]}; $CellContext`newP2$ := {(
             Part[$CellContext`p3$, 1] - 
             Part[$CellContext`p2$, 1]) $CellContext`t$$ + 
           Part[$CellContext`p2$, 1], (Part[$CellContext`p3$, 2] - 
             Part[$CellContext`p2$, 2]) $CellContext`t$$ + 
           Part[$CellContext`p2$, 2]}; Graphics[{
           PointSize[Large], 
           Point[$CellContext`p1$], 
           Point[$CellContext`p2$], 
           Point[$CellContext`p3$], 
           Line[{$CellContext`p1$, $CellContext`p2$}], 
           Line[{$CellContext`p2$, $CellContext`p3$}], Red, 
           Point[$CellContext`newP1$], 
           Point[$CellContext`newP2$], 
           Line[{$CellContext`newP1$, $CellContext`newP2$}], Green, 
           Line[
            
            Table[{(Part[$CellContext`newP2$, 1] - 
                Part[$CellContext`newP1$, 1]) $CellContext`t$$ + 
              Part[$CellContext`newP1$, 1], (Part[$CellContext`newP2$, 2] - 
                Part[$CellContext`newP1$, 2]) $CellContext`t$$ + 
              Part[$CellContext`newP1$, 2]}, {$CellContext`t$$, 
              0, $CellContext`t$$, 0.05}]], 
           
           Point[{(Part[$CellContext`newP2$, 1] - 
               Part[$CellContext`newP1$, 1]) $CellContext`t$$ + 
             Part[$CellContext`newP1$, 1], (Part[$CellContext`newP2$, 2] - 
               Part[$CellContext`newP1$, 2]) $CellContext`t$$ + 
             Part[$CellContext`newP1$, 2]}]}, Axes -> True, 
          PlotRange -> {{0, 1}, {0, 1}}]], 
      "Specifications" :> {{$CellContext`t$$, 0, 1}}, "Options" :> {}, 
      "DefaultOptions" :> {}],
     ImageSizeCache->{511., {274., 281.}},
     SingleEvaluation->True],
    Deinitialization:>None,
    DynamicModuleValues:>{},
    SynchronousInitialization->True,
    UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$},
    UnsavedVariables:>{Typeset`initDone$$},
    UntrackedVariables:>{Typeset`size$$}], "Manipulate",
   Deployed->True,
   StripOnInput->False],
  Manipulate`InterpretManipulate[1]]], "Output"]
}, Open  ]]
}, Open  ]]
}, Open  ]]
},
WindowToolbars->"EditBar",
WindowSize->{1600, 826},
WindowMargins->{{-8, Automatic}, {Automatic, -8}},
TaggingRules->{"$testsRun" -> False},
TrackCellChangeTimes->False,
SpellingDictionaries->{"CorrectWords"->{"Casteljau"}},
Magnification:>1.25 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 27, 0, 80, "Chapter"],
Cell[CellGroupData[{
Cell[632, 26, 104, 1, 42, "Subsubsection"],
Cell[CellGroupData[{
Cell[761, 31, 6752, 175, 721, "Input"],
Cell[7516, 208, 3495, 68, 575, "Output"]
}, Open  ]]
}, Open  ]]
}, Open  ]]
}
]
*)

